<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<%@ page import="performReservation.SMMDBBean"%>
<%@ page import="java.sql.*"%>

<jsp:useBean id="sale" scope="page" class="performReservation.Sales"/>

<% request.setCharacterEncoding("euc-kr");%>
<%!
	int per = 0;
	int cin = 0;
	String time = null;
	int seats = 0;
	String price = null;
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

</head>
<body>
	<%
		time = request.getParameter("time");
	price = request.getParameter("price");
		per = Integer.parseInt(request.getParameter("performance"));
		cin = Integer.parseInt(request.getParameter("cinema"));
		seats = Integer.parseInt(request.getParameter("vacancy"));
		if(seats == 0||per == 0||time.equals("")||cin == 0){
			out.println("you need to fill full all the blanks");
			
		}else{
			sale.setCinema(cin);
			sale.setPerformance(per);
			sale.setPrice(price);
			sale.setTime(Date.valueOf(time));
			sale.setVacancy(seats);
			SMMDBBean pProcess = SMMDBBean.getInstance();
			boolean b = pProcess.insertSale(sale);
			if(b){
				out.println("sale  "+"has been added");
			}else{
				out.println("SQL error");
			}
		}
	%>	
</body>
</html>